import request from '@/utils/request'

// 查询处方单明细列表
export function listDetail(query) {
  return request({
    url: '/order/detail/list',
    method: 'get',
    params: query
  })
}

// 查询处方单明细列表
export function diagnoseDetail(diagnoseId) {
  return request({
    url: `/order/detail/list/${diagnoseId}`,
    method: 'get',
  })
}

// 查询处方单明细详细
export function getDetail(id) {
  return request({
    url: '/order/detail/' + id,
    method: 'get'
  })
}

// 新增处方单明细
export function addDetail(data) {
  return request({
    url: '/order/detail',
    method: 'post',
    data: data
  })
}

// 修改处方单明细
export function updateDetail(data) {
  return request({
    url: '/order/detail',
    method: 'put',
    data: data
  })
}

// 删除处方单明细
export function delDetail(id) {
  return request({
    url: '/order/detail/' + id,
    method: 'delete'
  })
}

// 导出处方单明细
export function exportDetail(query) {
  return request({
    url: '/order/detail/export',
    method: 'get',
    params: query
  })
}

// 获取商品信息
export function getMaterialList(diagnoseId, barcode) {
  return request({
    url: `/order/detail/${diagnoseId}/material/${barcode}`,
    method: 'get'
  })
}

// 获取手工发药商品列表
export function getMaterialSendList(diagnoseId) {
  return request({
    url: `/order/detail/${diagnoseId}/material/list`,
    method: 'get'
  })
}
